package com.base.util;


import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;

/**
 * 时间工具类
 *
 * @author cjq on 20190722
 */
public class DateUtil {

    /**
     * 获取当前时间(指定格式)
     *
     * @return
     */
    public static String getFormatTimeNow(String format) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+8")); //北京时间，东八区
        return simpleDateFormat.format(calendar.getTime());
    }
}

